﻿using System;
using System.Drawing;
using System.IO;
using System.Reflection;
using log4net;

namespace com.szmxsoft.yeming
{
	// Token: 0x02000017 RID: 23
	public class Utils
	{
		// Token: 0x0600003A RID: 58 RVA: 0x000027D9 File Offset: 0x000009D9
		public static bool checkStr(string str)
		{
			if (str == null)
			{
				return true;
			}
			str = str.Trim();
			return str.Length < 1;
		}

		// Token: 0x0600003B RID: 59 RVA: 0x000027F4 File Offset: 0x000009F4
		public static Image getImage(string filepath)
		{
			Image result = null;
			FileStream fileStream = null;
			try
			{
				fileStream = new FileStream(filepath, FileMode.Open);
				byte[] array = new byte[fileStream.Length];
				fileStream.Read(array, 0, array.Length);
				MemoryStream stream = new MemoryStream(array);
				result = Image.FromStream(stream);
			}
			catch (Exception ex)
			{
				Utils.LOGGER.Error("从文件" + filepath + "中获取图片发生错误:" + ex.Message, ex);
			}
			finally
			{
				if (fileStream != null)
				{
					fileStream.Close();
					fileStream.Dispose();
				}
			}
			return result;
		}

		// Token: 0x040000DB RID: 219
		private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
	}
}
